﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MES_SystemUI.UI
{
    public partial class DataForm : Form
    {
        public DataForm()
        {
            InitializeComponent();
            button1.Click += Button1_Click;
            button2.Click += Button2_Click;
        }
        #region 属性
        private int _page = 1;
        // 页数
        public int Page
        {
            get { return _page; }
            set { _page = value;
                label2.Text ="共"+ _page.ToString()+"页";
            }
        }
        private int _numberPage = 1;
        // 当前页
        public int NumberPage
        {
            get { return _numberPage; }
            set { _numberPage = value;
                label1.Text = _numberPage.ToString();
            }
        }

        #endregion
        // 下
        private void Button2_Click(object sender, EventArgs e)
        {
            NumberPage++;
            if (NumberPage > _page)
            {
                NumberPage = _page;
            }
            BindDataGridView();
        }
        // 上
        private void Button1_Click(object sender, EventArgs e)
        {
            NumberPage--;
            if(NumberPage == 0)
            {
                NumberPage = 1;
            }
            BindDataGridView();
        }

        public virtual void BindDataGridView()
        {
            // 获取总页数,每页十条数据
            // 绑定数据
        }

    }
}
